Crate panic_semihosting [] [src]

Report panic messages to the host stderr using semihosting

This crate contains an implementation of panic_fmt that logs panic messages to the host stderr using cortex-m-semihosting. Currently, this crate only supports the ARM Cortex-M architecture.

Requirements

To build this crate on the stable or beta channels arm-none-eabi-gcc needs to be installed and available in $PATH.

Usage

This example is not tested
#![no_std]

extern crate panic_semihosting;

fn main() {
    panic!("FOO")
}
(gdb) monitor arm semihosting enable
(gdb) continue
Program received signal SIGTRAP, Trace/breakpoint trap.
rust_begin_unwind (args=..., file=..., line=8, col=5)
    at $CRATE/src/lib.rs:69
69          asm::bkpt();
$ openocd -f (..)
(..)
panicked at 'FOO', src/main.rs:6:5

Optional features

inline-asm

When this feature is enabled semihosting is implemented using inline assembly (asm!) and compiling this crate requires nightly.

When this feature is disabled semihosting is implemented using FFI calls into an external assembly file and compiling this crate works on stable and beta.

Apart from the toolchain requirement, enabling inline-asm removes the requirement of having arm-none-eabi-gcc installed on the host.